package com.item.service.impl;

import com.github.pagehelper.PageHelper;
import com.item.domain.TbVideo;
import com.item.mapper.TbVideoMapper;
import com.item.po.TbVideoPo;
import com.item.service.TbVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class TbVideoServiceImpl implements TbVideoService {

    @Autowired
    TbVideoMapper tbVideoMapper;


    public List<TbVideoPo> findAll(int limit, int page, TbVideo tbVideo) {
        if (limit > 0 && page > 0) {
            PageHelper.startPage(limit, page);
        }
        return tbVideoMapper.findAll(tbVideo);
    }


    public int add(TbVideo tbVideo) {

        return tbVideoMapper.insertSelective(tbVideo);
    }


    public int update(TbVideo tbVideo) {
        return tbVideoMapper.updateByPrimaryKey(tbVideo);
    }

    @Override
    public int delete(int id) {
        return tbVideoMapper.deleteByPrimaryKey(id);
    }
}
